<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/20 0020
 * Time: 21:15
 */
$str = 'helloWorld hiWorld qwerty hello as134a h64eca low6 qhellos';
//$pat = '/q/';
//preg_match($pat,$str,$mats);
//var_dump($mats);
//preg_match_all($pat,$str,$mats);
//var_dump($mats);
//echo preg_replace($pat, '1',$str);
//$pat ='/\s/'; //表示所有的空白字符
//$res =  preg_split($pat,$str);
//var_dump($res);
//找到所有的hello
//$pat = '/\bhello\b/';
//preg_match_all($pat,$str,$mats);
//var_dump($mats);
//找到h开头的单词
//$pat = '/\bh[a-zA-Z0-9]+/';
//preg_match_all($pat,$str,$mats);
//var_dump($mats);
//找到以hello开头的字符串
//$pat = '/\b[hello]\w/';
//preg_match_all($pat,$str,$mats);
//var_dump($mats);
//找到不以hello开头的字符串
$pat = '/[^h]\w+/';
preg_match_all($pat,$str,$mats);
var_dump($mats);
//找到两边都有字母的hello
//$pat = '/\Bhello\B/';
//preg_match_all($pat,$str,$mats);
//var_dump($mats);
